package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpInventoryCheckInPageUtil extends SeleniumPageUtil {
	public final static By ICI_SPAN_MAIN_HEADER = By.id("ctl46_lblHdr");
	public final static By ICI_TD_SRO_NO = By.xpath("//*[@id='frameHeader']/table/tbody/tr[1]/td[1]");
	public final static By ICI_INPUT_SRO_NO = By.id("ctl46_txtSroNumber");
	public final static By ICI_TD_WAREHOUSE = By.xpath("//*[@id='frameHeader']/table/tbody/tr[2]/td[1]");
	public final static By ICI_INPUT_WAREHOUSE = By.id("ctl46_txtWarehouse");
	
	// elements of checked in section
	public final static By ICI_SPAN_SECTION_HEADER = By.id("ctl46_checkedOutSectionHeader");
	
	public static void enterInventoryCheckInPage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterInventoryCheckInPage();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				ICI_SPAN_MAIN_HEADER, ICI_TD_SRO_NO, ICI_INPUT_SRO_NO, ICI_TD_WAREHOUSE, ICI_INPUT_WAREHOUSE, ICI_SPAN_SECTION_HEADER
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICI_SPAN_MAIN_HEADER));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICI_TD_SRO_NO));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICI_INPUT_SRO_NO));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICI_TD_WAREHOUSE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICI_INPUT_WAREHOUSE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICI_SPAN_SECTION_HEADER));
	}
}
